<template>
   <div>
       <el-autocomplete
                   ref="autocomplete"
                   v-model="give"
                   :fetch-suggestions="(query,cb)=>{querySearchAsync_empid(query,cb,menuPath)}"
                   @select="handleSelect($event)"
                   :placeholder="placeholder"
                   @blur="blurEvent($event)"
                   class="w100"
                   :size="size"
                   :trigger-on-focus="false"
        ></el-autocomplete>

   </div>


</template>

<script>
import {querySearchAsync_empid} from "@/util/bpmUtil"

export default {
  name:'auto',
  data() {
      return {
          returnForm:{
              nameInfo:null
          },
      }
  },
  props: {
    give: String,
    size: String,
    placeholder: String,
    menuPath:String
  },
  model: {
    prop: 'give',
    event: 'input'
  },
  mounted() {
    
  },
  methods: {
    querySearchAsync_empid,
    handleSelect(selection) {
          this.$emit('handleSelect',selection)
          this.$emit('select',selection)
          this.$emit('input',selection.userName)
          this.$emit('creatClearer',this)
    },
    clearInput(){
        this.returnForm.nameInfo = ''
        this.$emit('input','')
    },
    blurEvent(event){
        //19/08/06 lxf:防止用户手动输入未选择下拉框时，因为人的搜索实际上是使用工号搜索
        // console.log(this.returnForm.nameInfo,'this.returnForm.nameInfo33')
        this.returnForm.nameInfo = ''
        this.$emit('input','')
    }
  },
  
};
</script>
